﻿using Noke.Common;
using Noke.SOA.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Noke.SOA.Test
{
    public class TestManager : BaseManager
    {
        private static TestManager _instance = null;
        private TestManager() { }
        public static TestManager GetInstance()
        {
            if (_instance == null)
            {
                _instance = new TestManager();
            }
            return _instance;
        }

        // ********************************************************************************************************

        private const string ROUTE_URI_FORMAT = "Test/{0}";

        /// <summary>
        /// 格式化用户信息
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        public string GetUser(int userID, string userName)
        {
            using (SOAClient client = new SOAClient(IP, Port))
            {
                string uri = string.Format(ROUTE_URI_FORMAT, "GetUser");
                Dictionary<string, object> vari = new Dictionary<string, object>();
                vari.Add("userID", userID);
                vari.Add("userName", userName);
                return (string)Util.Bytes2Object(client.Invoke(uri, vari));
            }
        }

    }
}
